package models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import play.db.jpa.GenericModel;

@Entity
@Table(name="PROD_VIEW")
public class Product extends GenericModel {
	
	@Id
    @Column(name="CODPRO")
	public int id;
	
	@Column(name="DNCMER")
	public int merchantId;
	
	@Column(name="PPPRE")
	public int priceType;
	
	@Column(name="PRECIO")
	public float price;
	
	public static Product findById(int id, int merchant_id) {
		return Product.find("byIdAndMerchantIdAndPriceType", id, merchant_id, 2).first();
	}
		
}
